{extend name="layout/layout" /}

{block name="content"}
<style>
    .table-bordered>thead>tr>td, .table-bordered>tbody>tr>td, .table-bordered>tfoot>tr>td{
        line-height: 50px;
        text-align: center;
    }
</style>

<div class="row js-check-wrap">
    <div class="col-lg-12">
        <div class="portlet light">
            <div class="box-header">
                <div class="row">
                    <div class="col-md-10">
                        <form id="searchForm" action="{$pageSize.url}" class="form" method="post">
                            <div class="form-inline">
                                {if condition="($admin->type == 3) OR ($admin->type == 6)"}
                                    {$selectarea['cityname']}->{$selectarea['xianname']}->{$selectarea['townname']}
                                {elseif condition="($admin->type == 4)"}
                                    {$selectarea['cityname']}->{$selectarea['xianname']}->{$selectarea['townname']}->{$selectarea['villagename']}
                                {elseif condition="($admin->type == 2)"}
                                    {$selectarea['cityname']}->{$selectarea['xianname']}
                                    <select id="town" name="townId" class="form-control" data-hasvillage="on" ></select>
                                {elseif condition="($admin->type == 1)"}
                                    {$selectarea['cityname']}
                                    <select id="xian" name="xianId" class="form-control" ></select>
                                    <select id="town" name="townId" class="form-control" data-hasvillage="on" ></select>
                                {else/}
                                    <select id="city" name="cityId" class="form-control" ></select>
                                    <select id="xian" name="xianId" class="form-control" ></select>
                                    <select id="town" name="townId" class="form-control" data-hasvillage="on" ></select>
                                {/if}

                                <input type="hidden" class="form-control city" name="city" value="">
                                <input type="hidden" class="form-control xian" name="xian" value="">
                                <input type="hidden" class="form-control town" name="town" value="">
                                <input type="hidden" class="form-control village" name="village" value="">

                                <input type="text" class="form-control" name="name" value="" placeholder="机构名">
                                &nbsp;&nbsp;&nbsp;
                                <button id="doSearch" type="button" class="btn btn-success" title="筛选">
                                    <i class="fa fa-search"></i> 筛选
                                </button>
                                <!--<a href="{$currentUrl}?reset=1" class="btn btn-danger"><i class="fa fa-trash"></i> 清空</a>-->
                                <button type="reset" class="btn btn-danger" title="清空">
                                    <i class="fa fa-trash"></i> 清空
                                </button>
                            </div>
                        </form>
                    </div>
                    <div class="col-md-2">
                        <div class="pull-right">
                            <a href="{:url('admin/'.strtolower($model).'/add')}" class="btn blue btn-circle"><i class="fa fa-plus"></i> 新增机构</a>
                        </div>
                    </div>
                </div>
            </div>
            <div class="portlet-body">
                <form class="js-ajax-form" method="post">
                    <div class="">
                        <table id="data-table" class="table table-bordered table-hover dataTable">
                            <thead>
                                <th>机构</th>
                                <th>部门</th>
                                <th>排序</th>
                                <th>创建时间</th>
                                <th>操作</th>
                            </thead>
                        </table>
                    </div>
                </form>
            </div>
        </div>
    </div>
</div>

<input type="hidden" class="getregion_url" value="{:url('admin/region/getregion')}">
<input type="hidden" class="getvillage_url" value="{:url('admin/region/getvillage')}">
<input type="hidden" class="adminType" value="{$admin.type}">
<input type="hidden" class="adminCity" value="{$admin.cityId}">
<input type="hidden" class="adminXian" value="{$admin.xianId}">
<input type="hidden" class="adminTown" value="{$admin.townId}">
<input type="hidden" class="adminVillage" value="{$admin.villageId}">

<input type="hidden" class="datalist_url" value="{:url('admin/'.strtolower($model).'/index')}">
<input type="hidden" class="edit_url" value="{:url('admin/'.strtolower($model).'/edit')}">
<input type="hidden" class="delete_url" value="{:url('admin/'.strtolower($model).'/delete')}">
<input type="hidden" class="department_url" value="{:url('admin/'.strtolower($model).'/department')}">
{/block}

{block name="pagescript"}
<script src="__STATIC__/admin/pages/js/searcharea.js" type="text/javascript"></script>
<script src="__STATIC__/admin/pages/js/institution.js" type="text/javascript"></script>
{/block}